package com.dale.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dale.common.dto.CommentDto;
import com.dale.entity.Comment;
import com.dale.mapper.CommentMapper;
import com.dale.mapper.UserMapper;
import com.dale.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author  ：MarkerHub
 * @since 2020-05-25
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {

    @Autowired
    private CommentMapper commentMapper;


//    public IPage<Comment> findParentComment(Page<Comment> page, Long bid) {
//        return commentMapper.findParentComment(page,bid);
//    }

    public IPage<CommentDto> findParentComment(Page<CommentDto> page, Long bid) {
        return commentMapper.findParentComment(page,bid);
    }
    @Override
    public IPage<CommentDto> findChildComment(Page<CommentDto> page,Long cid) {
        return commentMapper.findChildComment(page,cid);
    }

    @Override
    public List<CommentDto> findAllChildComments(Long parentCid) {

        return commentMapper.findAllChildComments(parentCid);
    }

    @Override
    public IPage<CommentDto> getAllComments(Page<CommentDto> page, Long bid) {
        return commentMapper.getAllComments(page, bid);
    }

}
